'use strict';

const BaseService = require('./base');

class MenuService extends BaseService {
  get _model() {
    return 'Menu';
  }

  async findAll({ auth = 'all', type } = {}) {
    let where = this.formatWhere({ exact: { type } });
    if (auth !== 'all') {
      where = this.formatWhere({ inOp: { id: auth }, exact: { type } });
    }
    const attributes = {
      exclude: this.app.getExcludeDate,
    };
    return this._findAll({ where, attributes });
  }
}

module.exports = MenuService;
